package com.nut;

import com.nut.entity.Activity;
import com.nut.interceptor.UniqueNameGenerator;
import com.nut.mapper.ActivityMapper;
import com.nut.util.SpringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Slf4j
@EnableTransactionManagement
@ComponentScan(nameGenerator = UniqueNameGenerator.class)
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
public class ZApplication {

    public static void main(String[] args) {

        ConfigurableApplicationContext context = SpringApplication.run(ZApplication.class, args);

        log.info("ActiveProfile=" + SpringUtil.getActiveProfile());
        Environment environment = context.getBean(Environment.class);
        log.info("http://localhost:" + environment.getProperty("local.server.port"));

//        ActivityMapper activityMapper = context.getBean(ActivityMapper.class);
//        Activity activity = activityMapper.selectById("2");
//        System.out.println(activity);
//        bean.updateSort("hot",1,2);
//        System.out.println("dd");

//        WxMpMessageRouter bean = context.getBean(WxMpMessageRouter.class);
//        System.out.printf(bean.toString());


    }

}



